package com.Ip.exception;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

public class myHandler implements HandlerExceptionResolver {

	@Override
	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
			Exception ex) {
		// TODO Auto-generated method stub
		Map<String, Object> model=new HashMap<>();
		ModelAndView mav=new ModelAndView();
//		ex.printStackTrace();
		System.out.println(ex);
		model.put("ex", ex);
		mav.addObject("ex",model);
		mav.setViewName("error");
		System.out.println(mav.getModel());
		return mav;
	}
}
